package com.rizzo.infrastructure.domain;

public enum KeyType {

	ALL("all"),
	PERFORMANCE("performance"),
	CACHE("cache"),
	QUOTA("quota"),
	NOTIFICATION("notification"),
	ERROR("error"),
	CONFIG("config"),
	DARK("dark"),
	LOCK("lock");

	public static final String allowableValues = "ALL,PERFORMANCE,CACHE,QUOTA,NOTIFICATION,ERROR";

	private String prefix;

	KeyType(String prefix) {
		this.prefix = prefix;
	}

	public String getPrefix() {
		return prefix;
	}

	public static KeyType fromPrefix(String token) {
		for (KeyType c : KeyType.values()) {
			if (c.prefix.equals(token)) {
				return c;
			}
		}
		throw new IllegalArgumentException("'" + token + "' could not be converted to a KeyType!");
	}


}
